/// Read Municipal_Year data and merge with ARN and Linea Base dataset

*** Merge Municipality characteristics

use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB.dta", clear 

merge m:1 origmun using "~/Dropbox/Replication_MVC/Datasets/Muninicpality_year/cross_section1.dta"
drop if _merge==2
drop _merge

save "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni.dta", replace

*** Merge adittional muni data

use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni.dta", clear

merge m:1 origmun using "~/Dropbox/Replication_MVC/Datasets/Muninicpality_year/cross_section2.dta"
drop if _merge==2  //no ex-combatants - only missings
drop _merge


save "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni2.dta", replace

*** Merge adittional muni data +

use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni2.dta", replace

merge m:m origmun year using "~/Dropbox/Replication_MVC/Datasets/Muninicpality_year/muni_year_price.dta"
drop if _merge==2 //no ex-combatants
drop _merge

merge m:m origmun year using "~/Dropbox/Replication_MVC/Datasets/Muninicpality_year/captures_MD.dta"
drop if _merge==2 //no ex-combatants
drop _merge

save "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni3.dta", replace 

*** Merge adittional muni data ++

use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni3.dta", clear

merge m:m origmun year using "~/Dropbox/Replication_MVC/Datasets/Muninicpality_year/gold_historic.dta" 
drop if _merge==2  //no ex-combatants
drop _merge

save "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni4.dta", replace 

*** Merge adittional muni data +++

use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni4.dta", clear

merge m:1 origmun using "~/Dropbox/Replication_MVC/Datasets/Muninicpality_year/labor_mobility.dta"
drop if _merge==2  //no ex-combatants
drop _merge

save "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/ACR_LB_Muni5.dta", replace 

